package com.qbccn.onlinetest.mapper;

import com.qbccn.onlinetest.domain.MeDataPermission;
import com.qbccn.onlinetest.vo.TreeCompanyVo;
import java.util.List;
import org.apache.ibatis.annotations.Param;

/**
 * @author linke
 * @date 2020/7/12 17:03
 * @description
 */
public interface MeDataPermissionMapper {

  int insertSelective(MeDataPermission record);

  MeDataPermission selectByPrimaryKey(Integer id);

  int updateByPrimaryKeySelective(MeDataPermission record);

  int updateByPrimaryKey(MeDataPermission record);

  List<MeDataPermission> getMyDataPermission(String username);

  void deleteByUsername(String username);

  void insertByUsername(@Param("username") String username, @Param("list") List<String> list);

  List<TreeCompanyVo> get(@Param("username") String username,
      @Param("companyCode") String companyCode,
      @Param("level") int level);

  List<TreeCompanyVo> getLevel4Or3(@Param("companyCode") String companyCode,
      @Param("level") int level);

  /**
   * 是否有该城市数据权限
   * @param username
   * @param companyCode
   * @return
   */
  boolean hasPermissionToCityLevel(@Param("username") String username,@Param("companyCode") String companyCode);

  /**
   * 判断是否是直辖市  是 true
   * @param companyCode
   * @return
   */
  boolean isDirectCity(@Param("companyCode") String companyCode);
}
